<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
  </head>
  <body>
    <script src="./vue.js"></script>
    <script>
      // Object.defineProperty(obj,{});
      // obj = {}
      // obj = new Object();
      const vm = new Vue({
        // 定义属性（数据）
        data: {
          username: "jack", // vm.username = "jack";
          age: 20,
        },
        // 定义方法
        methods: {
          // vm.say = function () {};
          say() {
            console.log(this.username); //this===vm
          },
          add(x, y) {
            return x + y;
          },
        },
      });
      console.log(Vue);
      console.log(vm); //{}
      // vm.username = "jack";
      // vm.say = function () {};
      console.log(vm.username); //jack
      vm.say();
      console.log(vm.add(1, 3)); //4
    </script>
  </body>
</html>
